import request from '@/utils/request'


// 查询保险地区列表
export function listAllRegion(pid) {
  return request({
    url: '/system/region/list',
    method: 'get',
    params: {pid}
  })
}

// 查询部门下拉树结构
export function treeselect(isLevel) {
  return request({
    url: '/system/region/treeselect',
    method: 'get',
    params:{
      activaStatus:'1',
      level:isLevel ? isLevel :4
    }
  })
}

export function setActive(id, status){
  return request({
    url:'/system/region/activa',
    method:'put',
    data:{
      regionid:id,
      activaStatus:status
    }
  })
}

// 查询保险地区详细
export function getRegion(regionid) {
  return request({
    url: '/system/region/' + regionid,
    method: 'get'
  })
}

// 修改保险地区
export function updateRegion(data) {
  return request({
    url: '/system/region',
    method: 'put',
    data: data
  })
}
// 省直类型状态修改
export function changeUserStatus(regionid, shengLei) {
  const data = {
    regionid,
    shengLei
  }
  return request({
    url: '/system/allowance/changeStatus',
    method: 'put',
    data: data
  })
}


//根据id查询子数据
export function treeselectSon(regionid) {
  return request({
    url: `/system/region/treeselectById`,
    method: 'get',
    params:{
      regionid
    }
  })
}


export function activationRegion(regionid,status){
  return request({
    url:'/system/region/treeselectById',
    params:{
      regionid,
      status
    }
  })
}
